﻿using HT.Future.Common;
using HT.Future.Entities;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace HT.Future.IService
{
    /// <summary>
    /// 商品服务
    /// </summary>
    public interface IProductService : IBaseService<Product>
    {
        /// <summary>
        /// 是否存在指定名称的商品类型
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        Task<bool> IsExistProductTypeAsync(string name);
        /// <summary>
        /// 指定的商品类型下是否存在商品
        /// </summary>
        /// <param name="productTypeId"></param>
        /// <returns></returns>
        Task<bool> IsExistProductTypeAsync(int productTypeId);

        /// <summary>
        /// 生成商品类型
        /// </summary>
        /// <param name="types">商品实体列表</param>
        /// <returns></returns>
        Task GenerateProductTypeAsync(IEnumerable<ProductType> types);

        /// <summary>
        /// 获取商品列表
        /// </summary>
        /// <param name="typeId">商品类型id</param>
        /// <param name="status">商品状态（上架/下架）</param>
        /// <param name="key">搜索关键字</param>
        /// <param name="paging">商品分页信息</param>
        /// <returns></returns>
        Task<List<Product>> GetProductsAsync(int typeId, int status, string key, PagingQuery paging);

        /// <summary>
        /// 获取商品类型下最大的商品排序码
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        Task<int> GetProductMaxSortAsync(int typeId);

        /// <summary>
        /// 创建商品
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        Task<Product> CreateProductAsync(Product product);

        /// <summary>
        /// 更新商品
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        Task<Product> UpdateProductAsync(Product product);

    }
}
